﻿<UserControl x:Class="Wulong.Phone.Dianping.Views.PromotionItemView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:util="clr-namespace:Wulong.Phone.Dianping.Utils;assembly=Wulong.Phone.Dianping.Utils"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="800" d:DesignWidth="480">
    
    <Grid x:Name="LayoutRoot" 
          VerticalAlignment="Bottom">
    	<Grid.Resources>
    		<Style x:Key="DiscountGrid" TargetType="Grid"/>
    	</Grid.Resources>
    	<Grid.Style>
    		<StaticResource ResourceKey="DiscountGrid"/>
    	</Grid.Style>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        
        <Grid Grid.Row="1"
              Visibility="{Binding IsBusy, Converter={StaticResource BooleanToVisibilityConverter}}"
              Canvas.ZIndex="2">
            <TextBlock Text="{Binding Appi18n.Loading, Source={StaticResource ls}}" 
                       Style="{StaticResource LoadingStyle}" 
                       VerticalAlignment="Center"/>
            <toolkit:PerformanceProgressBar 
                IsIndeterminate="{Binding IsBusy}"
                VerticalAlignment="Center"
                />
        </Grid>
        <adduplex:AdControl 
            xmlns:adduplex="clr-namespace:AdDuplex;assembly=AdDuplex.AdControl.Silverlight"
            Grid.Row="2"
            AppId="4135" 
            Background="Transparent"
            BackgroundOpacity="0.5"
            VerticalAlignment="Bottom"
            />
        <Grid Margin="0,0,6,-23" 
              Width="446" 
              Height="289">
        	<Grid.Background>
        		<ImageBrush 
                    Stretch="Fill" 
                    ImageSource="/Images/PromotionBack.png"/>
        	</Grid.Background>
        	<TextBlock 
                Margin="0,0,2,0" 
                TextWrapping="Wrap" 
                Text="{Binding PromotionItem.Title}" 
                Foreground="#FFBCF52B" 
                HorizontalAlignment="Right" 
                FontWeight="Bold" 
                VerticalAlignment="Top"/>
        	<TextBlock 
                Margin="0,27,124,0" 
                TextWrapping="Wrap" 
                Text="{Binding PromotionItem.Content}" 
                Foreground="Snow" 
                FontSize="18" 
                VerticalAlignment="Top"/>
        	<Image 
                HorizontalAlignment="Right" 
                Margin="0,91,0,101" 
                Source="{Binding PromotionItem.ImageUrl}" 
                Stretch="Fill" 
                Width="120" 
                RenderTransformOrigin="0.5,0.5" 
                UseLayoutRounding="False" 
                d:LayoutRounding="Auto">
        		<Image.RenderTransform>
        			<CompositeTransform Rotation="-23.733"/>
        		</Image.RenderTransform>
        	</Image>
        	<TextBlock 
                HorizontalAlignment="Left" 
                Margin="174.989,0,0,37.153" 
                TextWrapping="Wrap" 
                Text="{Binding PromotionItem.SubTitle}" 
                Width="251.688" 
                FontSize="24" 
                RenderTransformOrigin="0.5,0.5" 
                UseLayoutRounding="False" 
                d:LayoutRounding="Auto" 
                Foreground="#FFFF1111" 
                Canvas.ZIndex="1" 
                VerticalAlignment="Bottom">
        		<TextBlock.RenderTransform>
        			<CompositeTransform Rotation="9.159"/>
        		</TextBlock.RenderTransform>
        	</TextBlock>
        	<TextBlock 
                Margin="8,0,101,0" 
                TextWrapping="Wrap" 
                Text="{Binding PromotionItem.Notice}" 
                FontSize="13.333" 
                Height="40" 
                VerticalAlignment="Bottom"/>
        </Grid>
        <StackPanel Grid.Row="1"
                    VerticalAlignment="Bottom"
                    Height="300">
            <phone:WebBrowser 
                Width="480"
                Height="300"
                util:WebBrowserHelper.Source="{Binding SendLink}"
                Visibility="{Binding IsSendLink, Converter={StaticResource BooleanToVisibilityConverter}}"
                />
        </StackPanel>
        <Border Background="Transparent" 
                Grid.Row="3"
                HorizontalAlignment="Center"
                VerticalAlignment="Bottom">
            <StackPanel Orientation="Horizontal" 
                        HorizontalAlignment="Center"
                        Visibility="{Binding ButtonAvailable, Converter={StaticResource BooleanToVisibilityConverter}}">
                <Button
                        x:Name="SendToMyPhone"
                        Style="{StaticResource NoBorderBtnStyle}">
                    <StackPanel>
                        <Image Source="/Images/Btn_Sms.png"/>
                        <TextBlock Text="{Binding Appi18n.SendToMyPhone, Source={StaticResource ls}}" 
                                       FontSize="12"
                                       Foreground="White"/>
                    </StackPanel>
                </Button>
                <Button
                        x:Name="ViewMerchants"
                        Style="{StaticResource NoBorderBtnStyle}">
                    <StackPanel>
                        <Image Source="/Images/Btn_View.png"/>
                        <TextBlock Text="{Binding Appi18n.ViewMerchants, Source={StaticResource ls}}" 
                                       FontSize="12"
                                       Foreground="White"/>
                    </StackPanel>
                </Button>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>
